Delete a set of cases from Dict. Given: sampleDict = name: Kelly, age: 25, salary: 8000, city: New york keysToRemove = [name, salary] output: city: New york, age: 25

34

sample_dict = {
    "name": "Kelly",
    "age": 25,
    "salary": 8000,
    "city": "New york"
}

# Keys to remove
keys = ["name", "salary"]

Comments

Submit
0 Comments